import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from "./router/index.js";
import App from './App.vue'
import instance from "./views/instance";
const app = createApp(App)

//配置 axios 拦截器，在每个请求中添加 JWT 令牌：
instance.interceptors.request.use(
    config => {
        const token = localStorage.getItem('token');
        if (token) {
            config.headers['token'] = token;
        }
        return config;
    },
    error => {
        return Promise.reject(error);
    },
);

app.use(ElementPlus)
app.use(router)
app.mount('#app')











